--[[ 编码: JX-24-13 名称: 出库单--显示前 作者:HAN 日期:2025-1-29 入口函数:BeforeGridShow 功能说明: 控制行按钮显示 V2.0 HAN 2025-2-23 新增状态及行按钮控制 --]] json = require ("json") mobox = require ("OILua_JavelinExt") m3 = require("oi_base_mobox") function BeforeGridShow ( strLuaDEID ) local nRet, strRetInfo local cntr_objs local n, nCount local bs_state_name = {"未配货","配货中","配货完成","作业中","出库完成","错误","暂停中","暂停","关闭中","关闭"} local cr_state_name = {"未回报", "回报成功", "接口错误", "反馈错误"} nRet, cntr_objs = m3.GetSysDataJson( strLuaDEID ) if ( nRet ~=0 ) then lua.Error( strLuaDEID, debug.getinfo(1), cntr_objs ) end nCount = #cntr_objs if (nCount == 0) then return end local obj local row_data_set = {} local bs_state local wave_no for n = 1, nCount do local row_item = {} obj = cntr_objs[n] row_item.id = obj.id row_item.attrs = {} row_item.row_button_hidden = "定版" wave_no = '' -- 获取 项目清单 对象属性 for nIndex = 1, #obj.attrs do local attr_value = {} attr_value.attr = obj.attrs[nIndex].attr attr_value.value = obj.attrs[nIndex].value if ( attr_value.attr == 'N_B_STATE' ) then bs_state = lua.StrToNumber( attr_value.value ) attr_value.value = bs_state_name[bs_state+1] elseif ( attr_value.attr == 'S_WAVE_NO' ) then wave_no = attr_value.value elseif ( attr_value.attr == 'S_STATE' ) then if ( attr_value.value == '新建') then row_item.row_button_hidden = "" end -- 完工回报状态处理 elseif (attr_value.attr == 'N_CR_STATE') then cr_state = lua.StrToNumber(attr_value.value) if (cr_state >= 0 and cr_state <= 3) then attr_value.value = cr_state_name[cr_state + 1] end end table.insert( row_item.attrs, attr_value ) end table.insert( row_data_set, row_item) end local action = { { action_type = "reset_data_attr", value = row_data_set } } nRet, strRetInfo = mobox.setAction(strLuaDEID, lua.table2str(action)) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction错误: "..strRetInfo) end end